package com.example.utrl;

/**
 * @author ：lqs
 * @date ：Created in 2023/8/31 15:19
 * @description：
 * @modified By：
 * @version:
 */
public class PageUntil {
    //当前页数
    private int pageIndex=1;
    //每页数据量
    private int pageSize = 5;
    //总数据量
    private int pageTotalCount;
    //总页数
    private int pageTotal;



    public int getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageTotalCount() {
        return pageTotalCount;
    }

    public void setPageTotalCount(int pageTotalCount) {
        //当设置总数据量时，计算总页数=总数据量/每页数据量
        if (pageTotalCount % pageSize == 0) {
            //当总数据量可以除尽: 是偶数时
            pageTotal = pageTotalCount / pageSize;
        } else {
            //当总数据量除不尽，可能有余数(总页数+1)
            pageTotal = pageTotalCount / pageSize + 1;
        }
    }


    public int getPageTotal() {
        return pageTotal;
    }

    public void setPageTotal(int pageTotal) {
        this.pageTotal = pageTotal;
    }
}

